<!-- Load TinyMCE -->
<script type="text/javascript" src="media/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="media/tiny_mce/config.js"></script>
<script type="text/javascript" src="themes/gcdnew/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$(function(){
	$("#frmMain").validate({
		rules: 
		{
			"title": 
			{ 
				required: true
			}
		},
		messages:
		{
			"title": 
			{ 
				required: "กรุณากรอกหัวข้อค่ะ"
			}
		}
	});		
})
</script>
<h1>เอกสารวิชาการ</h1>
<form id="frmMain" action="documents/admin/documents/save/<?php echo $document->id ?>" method="post" enctype="multipart/form-data" >
	
<table class="form">
	<tr><th>หมวดหมู่ :</th><td><?php echo form_dropdown('category_id',$document->category->get_option(),$document->category_id,'');?></td></tr>
	<tr>
		<th>หัวข้อ :</th>
		<td>
			<input type="text" name="title" rel="th" value="<?php echo $document->title?>" class="full" />
		</td>
	</tr>
	<tr>
		<th>ไฟล์แนบ :</th>
		<td><input type="text" name="file" value="<?php echo $document->file?>"/><input type="button" name="browse" value="เลือกไฟล์" onclick="browser($(this).prev(),'documents')" /></td>
	</tr>
	<tr><th>เริ่ม :</th><td><input type="text" name="start_date" value="<?php echo DB2Date(($document->start_date)?$document->start_date:date("Y-m-d"))?>" class="datepicker" /></td></tr>
		<tr><th>สิ้นสุด :</th><td><input type="text" name="end_date" value="<?php echo DB2Date($document->end_date)?>" class="datepicker" /></td></tr>
		<tr>	
	<tr><th></th><td><input type="submit" value="บันทึก" /><?php echo form_back() ?></td></tr>
</table>
<?php echo form_referer() ?>
</form>